package com.tyd.cams.dialog;

import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

import androidx.annotation.NonNull;

import com.tyd.cams.R;


/**
 * @author zhw
 * @CreateDate: 2021/2/26
 * @Title:
 * @模块：
 * @说明：社团提交
 */
public class ClubDialog extends Dialog implements View.OnClickListener {

    private Context context;
    private String content;
    private OnClicktener listener;
    private TextView cancel, tv_commit, tv_title;

    public ClubDialog(@NonNull Context context, String content, OnClicktener listener) {
        super(context, R.style.FdbDialog);
        this.context = context;
        this.content = content;
        this.listener = listener;
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.tv_cancel:
                dismiss();
                break;
            case R.id.tv_commit:
                if (listener != null) {
                    listener.onClick();
                    dismiss();
                }
                break;
        }
    }

    public interface OnClicktener {
        void onClick();
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.dialog_club);
        cancel = findViewById(R.id.tv_cancel);
        cancel.setOnClickListener(this);
        tv_commit = findViewById(R.id.tv_commit);
        tv_commit.setOnClickListener(this);
        tv_title = findViewById(R.id.tv_title);
        tv_title.setText(content);
    }

    //去掉dialog的BACK事件
    public void onBackPressed() {

    }
}

